var app = sm("do_App");
var page = sm("do_Page");
var nf = sm("do_Notification");
var hashdata = mm("do_HashData");
var http = require("helper/http");
var openHelper = require("helper/open");
var circleUrl = require("url/circle");


var httpUrl4Info = circleUrl.url.info.moreInfo;
//andriod返回键
page.on("back", function() {
	app.closePage();
});

var circleId = null;
page.on("loaded", function() {
	circleId = page.getData().circleId;
	showCircleInfo();
});

var layoutHead = ui("layoutHead");
var addheader = layoutHead.add("header", "source://view/reuse/header.ui", 0, 0);
//左上角-返回
var headerLeft = ui(addheader+".headerLeft");
headerLeft.on("touch", function() {
  app.closePage()
});
var header = ui("header");
header.bindData(hashdata);
hashdata.addData({
  "labelTitle" : "圈子资料"
})
header.refreshData();

//查询圈子info
function showCircleInfo(){
	http.post(httpUrl4Info,{id:circleId},function(data){
		var circleInfo = data.circleInfo;
		var circleBase = data.circleBase;
		if(circleBase!=null && circleInfo!=null){
			deviceone.print(JSON.stringify(circleBase));
			ui("imgLogo").source = circleBase.fullLogo;
			ui("lableName").text = circleBase.name;
			ui("lableCount").text = circleInfo.memberCount+"人 "+circleInfo.topicCount+"条贴子";
			ui("lableRemark").text = circleBase.remark;
			if(circleBase.lbName){
				ui("lableLbName").text = circleBase.lbName;
			}else{
				ui("lableLbName").text = "其他";
			}
			ui("imgOwnerLogo").source = circleBase.fullCreatorLogo;//圈主头象
			ui("lableOwnerName").text = circleBase.creatorName;
		}
	});
	
}